<template>
  <TheHeader :todo="todo" />
  <TodoItem :todo="todo" />
</template>
<script setup>
import TheHeader from './components/TheHeader.vue'
import TodoItem from './components/TodoItem.vue'
import { ref, onMounted } from 'vue'
const todo = ref([])
onMounted(() => {
  getTodos()
})
function getTodos() {
  let res = localStorage.getItem('todo')
  console.log(res)
  if (!res) {
    localStorage.setItem('todo', JSON.stringify([]))
  } else {
    todo.value = JSON.parse(res)
    console.log(todo.value)
  }
}
</script>
<style >
body {
  padding: 0;
  margin: 0;
}
</style>
